home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 5.9 KB | 179 lines | [TEXT/CWIE] |
- //----------------------------------------------------------------------------------------
- // UCustomViewerDocument.cp
- // Copyright © 1996 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UCustomViewerDocument__
- #include "UCustomViewerDocument.h"
- #endif
-
- // Sample QD3DViewer
-
- #ifndef __UQD3DViewer__
- #include "UQD3DViewer.h"
- #endif
-
- #ifndef __UCustomViewerWindow__
- #include "UCustomViewerWindow.h"
- #endif
-
- // MacApp
-
- #ifndef __UVIEWSERVER__
- #include "UViewServer.h"
- #endif
-
- #ifndef __UWINDOW__
- #include "UWindow.h"
- #endif
-
- //QD3D
- #ifndef QD3D_h
- #include <QD3D.h>
- #endif
-
- #ifndef QD3DViewer_h
- #include <QD3DViewer.h>
- #endif
-
- const ResNumber kCustomWindowID = 1000;
-
-
- //========================================================================================
- // CLASS TCustomViewerDocument
- //========================================================================================
- #undef Inherited
- #define Inherited TDocument
-
- #pragma segment AOpen
- MA_DEFINE_CLASS_M1(TCustomViewerDocument, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TCustomViewerDocument constructor
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TCustomViewerDocument::TCustomViewerDocument():
- fQD3DView1(NULL),
- fCustomViewerWindow(NULL)
- {
- } // TCustomViewerDocument::TCustomViewerDocument
-
- //----------------------------------------------------------------------------------------
- // TCustomViewerDocument::ICustomViewerDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TCustomViewerDocument::ICustomViewerDocument()
- {
- this->IDocument();
- } // TCustomViewerDocument::ICustomViewerDocument
-
- //----------------------------------------------------------------------------------------
- // TCustomViewerDocument destructor
- //----------------------------------------------------------------------------------------
- #pragma segment AClose
-
- TCustomViewerDocument::~TCustomViewerDocument()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TCustomViewerDocument::DoMakeViews:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TCustomViewerDocument::DoMakeViews(Boolean /*forPrinting*/) // Override
- {
- FailNIL(fCustomViewerWindow =(TCustomViewerWindow*) gViewServer->NewTemplateWindow(kCustomWindowID, this));
- fCustomViewerWindow->fCustomViewerDocument = this;
-
- fQD3DView1 = (TQD3DViewerView*) (fCustomViewerWindow->FindSubView('q3d2'));
- } // TCustomViewerDocument::DoMakeViews
-
-
- //----------------------------------------------------------------------------------------
- // TCustomViewerDocument::SetViewerFlags:
- //----------------------------------------------------------------------------------------
-
- void TCustomViewerDocument::SetViewerFlags()
- {
- unsigned long theViewerFlags = 0;
- TCheckBox* theShowBadgeCB;
- TCheckBox* theViewerActiveCB;
- TCheckBox* theControllerVisCB;
- //TCheckBox* theDraggingOffCB;
- TCheckBox* theCameraButtonCB;
- TCheckBox* theTruckButtonCB;
- TCheckBox* theOrbitButtonCB;
- TCheckBox* theZoomButtonCB;
- TCheckBox* theDollyButtonCB;
-
- //Check the rendering method - NOT a viewer flag
- TCheckBox* theWireFrameCB;
- FailNIL(theWireFrameCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('rend')));
- if(theWireFrameCB->IsOn())
- fQD3DView1->SetRenderer(kQ3RendererTypeWireFrame, TRUE);
- else
- fQD3DView1->SetRenderer(kQ3RendererTypeInteractive, TRUE);
-
- FailNIL(theShowBadgeCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('shBG')));
- FailNIL(theViewerActiveCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('vwAC')));
- FailNIL(theControllerVisCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('cVIS')));
- //FailNIL(theDraggingOffCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('****')));
- FailNIL(theCameraButtonCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('camB')));
- FailNIL(theTruckButtonCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('truB')));
- FailNIL(theOrbitButtonCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('orbB')));
- FailNIL(theZoomButtonCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('zooB')));
- FailNIL(theDollyButtonCB = (TCheckBox*)(fCustomViewerWindow->FindSubView('dolB')));
-
- if(theShowBadgeCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerShowBadge;
-
- if(theViewerActiveCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerActive;
-
- if(theControllerVisCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerControllerVisible;
-
- if(theCameraButtonCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerButtonCamera;
-
- if(theTruckButtonCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerButtonTruck;
-
- if(theCameraButtonCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerButtonCamera;
-
- if(theOrbitButtonCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerButtonOrbit;
-
- if(theZoomButtonCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerButtonZoom;
-
- if(theDollyButtonCB->IsOn())
- theViewerFlags = theViewerFlags | kQ3ViewerButtonDolly;
-
- fQD3DView1->SetViewerFlags(theViewerFlags);
- } // TCustomViewerDocument::SetViewerFlags
-
-
- //----------------------------------------------------------------------------------------
- // TCustomViewerDocument::DoMakeViews:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TCustomViewerDocument::SetViewerBackground()
- {
- CRGBColor newColor;
- CStr255 thePrompt = "Pick a new color";
- if (GetColor(kBestSystemLocation, thePrompt, NULL, newColor))
- {
- fQD3DView1->SetBackgroundColor(newColor,1.0,TRUE);
- }
- } // TCustomViewerDocument::DoMakeViews
-
- //----------------------------------------------------------------------------------------
- // End of UCustomViewerDocument.cp
-
-